package com.anrongtec.zcpt.ui.activity.myfocus;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.anrongtec.zcpt.R;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;

import java.util.List;

/**
 * Created by wangyingying on 2017/2/17.
 */

public class FocusAdapter extends TagAdapter {
    private List<String> list;
    private Context context;

    public FocusAdapter(List<String> list, Context context) {
        super(list);
        this.list = list;
        this.context = context;
    }

    @Override
    public View getView(FlowLayout parent, int position, Object o) {
        ViewHolder holder = new ViewHolder();

        RelativeLayout rl_parent = (RelativeLayout) LayoutInflater.from(context).
                inflate(R.layout.item_tag_flow_text, parent, false);

        if (list.size() > 0) {
            String focusText = list.get(position);
            holder.tv_focus_people = (TextView) rl_parent.findViewById(R.id.tv_focus_people);
            holder.tv_focus_msg_num = (TextView) rl_parent.findViewById(R.id.tv_focus_msg_num);

            holder.tv_focus_people.setText(focusText);
        }
        return rl_parent;
    }

    class ViewHolder {
        TextView tv_focus_people;
        TextView tv_focus_msg_num;
    }
}
